package com.demo.project_template.controller;

import com.demo.project_template.entity.GoldRecharge;
import com.demo.project_template.service.GoldRechargeService;
import com.demo.project_template.vo.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 金币充值配置 前端控制器
 * </p>
 *
 * @author 杨玉龙
 * @since 2024-08-20 11:48:57
 */
@Api(tags = "金币充值配置")
@RestController
@RequestMapping("/goldRecharge")
public class GoldRechargeController {
    @Resource
    private GoldRechargeService goldRechargeService;

    @ApiOperation(value = "查询金币充值配置列表")
    @GetMapping(value = "/list")
    public R<List<GoldRecharge>> list(){
        return R.success(goldRechargeService.list());
    }

    @ApiOperation(value = "添加金币充值配置")
    @PostMapping(value = "/add")
    public R<?> add(@RequestBody GoldRecharge goldRecharge){
        goldRechargeService.save(goldRecharge);
        return R.success();
    }

    @ApiOperation(value = "修改金币充值配置")
    @PostMapping(value = "/update")
    public R<?> update(@RequestBody GoldRecharge goldRecharge){
        goldRechargeService.updateById(goldRecharge);
        return R.success();
    }

    @ApiOperation(value = "删除金币充值配置")
    @DeleteMapping(value = "/id")
    public R<?> delete(@RequestParam Long id){
        goldRechargeService.removeById(id);
        return R.success();
    }
}
